package com.techsen.maven.plugins.version;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.command.status.StatusScmResult;

@Mojo(name = "check")
public class CheckMojo extends AbstractScmMojo {
    
    @Override
    public void execute() throws MojoExecutionException {

        try {
            StatusScmResult result = this.scmManager.status(this.getScmRepository(), this.getFileSet());
            this.checkResult(result);
            if (result.getChangedFiles().size() > 0) {
                throw new MojoExecutionException("exsits uncommitted files");
            }
        } catch (ScmException e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }

}
